package cn.stylefeng.guns.modular.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.entity.TaskDevice;
import cn.stylefeng.guns.modular.mapper.TaskDeviceMapper;
import cn.stylefeng.guns.modular.service.ITaskDeviceService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 任务设备表 服务实现类
 * </p>
 *
 * @author XiangTianGe
 * @since 2020-04-14
 */
@Service
public class TaskDeviceServiceImpl extends ServiceImpl<TaskDeviceMapper, TaskDevice> implements ITaskDeviceService {

    @Autowired
    private TaskDeviceMapper taskDeviceMapper;

    /**
     * 获取列表
     */
    @Override
    public LayuiPageInfo getList(Page<TaskDevice> page, String beginTime, String endTime, String keyword) {
        Page<Map<String, Object>> list = taskDeviceMapper.getList(page, beginTime, endTime, keyword);
        list.getRecords().forEach(f ->
                f.put("name", f.get("workshop_name") + "日常巡查报告"));
        return LayuiPageFactory.createPageInfo(list);
    }
}
